package org.dmikis.jmmengine.models;

import javax.swing.JPanel;

/**
 * @author dmikis
 * @version 0.1
 *
 * Interface for abstract model to be used in application.
 */
public interface Model {
    
    /**
     * Compute result according to the given model.
     */
    public void compute();
    
    /**
     * Get computation status.
     * 
     * @return part of the completed computation in percents. 
     */
    public int getStatus();
    
    /**
     * Generate and return panel for parameters dialog.
     * After changing parameters viewer have to execute <code>renewModelParameters()</code> method.
     * 
     * @return panel contains label and input fields for every parameter required by model
     */
    public JPanel getParametersPanel();
    
    /**
     * Renew model parameters by values obtained from panel obtained from the <code>getParametersPanel()</code>
     * method class instance returned by <code>getParametersPanel()</code> method.
     * 
     * <b>Warning!</b> After renew model parameters you have to renew all links to the result image!
     * 
     * @throws IllegalArgumentException if one or more parameters parsed as non-positive value.
     */
    public void renewModelParameters() throws IllegalArgumentException;
    
    /**
     * Get image representation of result.
     * 
     * @return result image
     */
    public Result getResult();
}
